#! /bin/csh -f

# Filename:      synth_spartan_3e.csh
# Description:   This script runs through the Synthesis flow for the Basys 2 
#                FPGA
#
# Date Created:  7/20/2011
# Author:        Cody Cziesler

if(! -d work_basys2) then
  echo "mkdir ./work_basys2/"
  mkdir work_basys2
endif

cd work_basys2

rm -rf *

mkdir xst
mkdir xst/projnav.tmp
mkdir tmp

echo ">> XST"
xst -intstyle ise -ifn "../omicron_basys2.xst" -ofn "omicron.syr" | tee omicron_xst.log

echo ">> NGDBUILD"
ngdbuild -intstyle ise -dd _ngo -sd ../../des/coregen -nt timestamp -p xc3s250e-cp132-4 omicron.ngc omicron.ngd -uc ../omicron_basys2.ucf 

echo ">> MAP"
map -intstyle ise -p xc3s250e-cp132-4 -cm area -ir off -pr off -c 100 -o omicron_map.ncd omicron.ngd omicron.pcf 

echo ">> PAR"
par -w -intstyle ise -ol high -t 1 omicron_map.ncd omicron.ncd omicron.pcf 

echo ">> TRCE"
trce -intstyle ise -v 3 -s 4 -n 3 -fastpaths -xml omicron.twx omicron.ncd -o omicron.twr omicron.pcf -ucf ../omicron_basys2.ucf

echo ">> BITGEN"
bitgen -intstyle ise -f ../omicron.ut omicron.ncd

echo "synth_spartan_3e.csh Done"
